#include "log.h"

const char* level_string(int level){
    switch (level)
    {
    case 1: return "WARING";
    case 2: return "ERROR ";
    case 3: return "FATAL ";
    case 4: return "NORMAL";
    case 5: return "DEBUG ";
    default:    return "UNDEFINE";
    }
}

void logmessage(int level,const char* message,...){
    // //[level][time]:message
    // char buffer1[1024];
    // time_t now;
    // now = time(nullptr);
    // struct tm* tm = localtime(&now);
    // snprintf(buffer1,1024,"[%s][%4d-%-2d-%-2d %-2d:%-2d:%-2d]",level_string(level) \
    // ,tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);

    // va_list va;
    // va_start(va,message);
    // char buffer2[1024];
    // vsnprintf(buffer2,1024,message,va);

    // FILE* fd = fopen(LOG,"a");
    // fprintf(fd,"%s%s\n",buffer1,buffer2);
    // fflush(fd);
    // fclose(fd);
    //暂时注释，防止影响测试效果
}